import { router, useCool } from "/@/cool";
const { storage } = useCool();

const ignoreToken = [
	"/pages/index/my",
	"/pages/user/login",
];

router.beforeEach((to, next) => {
	const token = storage.get("uni_id_token");
	if (ignoreToken.includes(to.path) || to.path.startsWith("/pages/demo")) {
		next();
	} else {
		if (token) {
			next();
		} else {
			router.login();
		}
	}
});